﻿/*
 
Celerity: Sensory Overload
Copright 2012 by Adam Hill, David Gannon, Thomas Tamblyn & Patrick Ytting
Contact: adam.hill@outlook.com
Website: adamhill.org
Licence: MS-Pl Licence
  
 */

using Celerity.ColourPalette;
using Celerity.Content;
using Celerity.Data;
using Celerity.Entities;
using Microsoft.Xna.Framework;
using System.Collections.Generic;

namespace Celerity.UI.Definition.Controls
{
    public class ControlStatusesControl : UIEntity
    {
        const int startY = 55;
        const int x = 80;
        const int gap = 75;
        const int lineOffset = 25;
        
        // Adjustment for the main bitmap(s)
        const int imgXOffset = -0;
        const int imgYOffset = -10;

        public override void ConfigureSelf()
        {
            IsPressable = true;
            DrawCondition = new UIDrawCondition
            {
                CheckGameState = true,
                CheckedGameStates = new List<GameState>
                        {
                            GameState.Menu
                        },
                CheckMenuState = true,
                CheckedMenuStates = new List<MenuState>
                        {
                            MenuState.MainMenu
                        },
            };
            Items = new List<UIEntityItem>
                    {
                        new UIEntityItem // Background
                        {
                            Size = this.Size,
                            Offset = this.Offset,
                            ImageDefault = ImageLibrary.TextureGrey,
                            ImagePressed = ImageLibrary.TextureGrey,
                        },

                        new UIEntityItem // Webcam Yes
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconYesWebcam,
                            ImagePressed = ImageLibrary.ControlsIconYesWebcam,
                            DrawCondition = new UIDrawCondition
                            {
                                CheckWebcam = true
                            }
                        },
                        new UIEntityItem // Webcam No
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconNoWebcam,
                            ImagePressed = ImageLibrary.ControlsIconNoWebcam,
                            DrawCondition = new UIDrawCondition
                            {
                                ExcludeMode = true,
                                CheckWebcam = true
                            }
                        },

                        new UIEntityItem // Gyro Yes
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconYesGyro,
                            ImagePressed = ImageLibrary.ControlsIconYesGyro,
                            DrawCondition = new UIDrawCondition
                            {
                                CheckGyro = true
                            }
                        },
                        new UIEntityItem // Gyro No
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconNoGyro,
                            ImagePressed = ImageLibrary.ControlsIconNoGyro,
                            DrawCondition = new UIDrawCondition
                            {
                                ExcludeMode = true,
                                CheckGyro = true
                            }
                        },

                        new UIEntityItem // Gamepad Yes
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconYesGamepad,
                            ImagePressed = ImageLibrary.ControlsIconYesGamepad,
                            DrawCondition = new UIDrawCondition
                            {
                                CheckGamepad = true
                            }
                        },
                        new UIEntityItem // Gamepad No
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconNoGamepad,
                            ImagePressed = ImageLibrary.ControlsIconNoGamepad,
                            DrawCondition = new UIDrawCondition
                            {
                                ExcludeMode = true,
                                CheckGamepad = true
                            }
                        },

                        new UIEntityItem // Keyboard Yes
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconYesKeyboard,
                            ImagePressed = ImageLibrary.ControlsIconYesKeyboard,
                            DrawCondition = new UIDrawCondition
                            {
                                CheckKeyboard = true
                            }
                        },
                        new UIEntityItem // Keyboard No
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(imgXOffset, imgYOffset),
                            ImageDefault = ImageLibrary.ControlsIconNoKeyboard,
                            ImagePressed = ImageLibrary.ControlsIconNoKeyboard,
                            DrawCondition = new UIDrawCondition
                            {
                                ExcludeMode = true,
                                CheckKeyboard = true
                            }
                        },




                        // Text...
                        new UIEntityItem // Input Control Text
                        {
                            ApplyCentring = true,
                            Size = this.Size,
                            Offset = this.Offset,
                            Font = FontLibrary.Heading,
                            FontColorDefault = Palette.White,
                            FontColorPressed = Palette.White,
                            Text = ResxText.Controls
                        },
                        
                        new UIEntityItem // Webcam Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY),
                            Font = FontLibrary.Standard,
                            FontColorDefault = Palette.White,
                            FontColorPressed = Palette.White,
                            Text = ResxText.Webcam
                        },
                        new UIEntityItem // Gyro Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap),
                            Font = FontLibrary.Standard,
                            FontColorDefault = Palette.White,
                            FontColorPressed = Palette.White,
                            Text = ResxText.Gyro
                        },
                        new UIEntityItem // Gamepad Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap * 2),
                            Font = FontLibrary.Standard,
                            FontColorDefault = Palette.White,
                            FontColorPressed = Palette.White,
                            Text = ResxText.Gamepad
                        },
                        new UIEntityItem // Keyboard Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap * 3),
                            Font = FontLibrary.Standard,
                            FontColorDefault = Palette.White,
                            FontColorPressed = Palette.White,
                            Text = ResxText.Keyboard
                        },



                        // Line 2...
                        new UIEntityItem // Webcam Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + lineOffset),
                            Font = FontLibrary.Body,
                            FontColorDefault = Palette.Black,
                            FontColorPressed = Palette.Black,
                            Text = ResxText.WebcamInstructions
                        },
                        new UIEntityItem // Gyro Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap + lineOffset),
                            Font = FontLibrary.Body,
                            FontColorDefault = Palette.Black,
                            FontColorPressed = Palette.Black,
                            Text = ResxText.GyroInstructions
                        },
                        new UIEntityItem // Gamepad Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap * 2 + lineOffset),
                            Font = FontLibrary.Body,
                            FontColorDefault = Palette.Black,
                            FontColorPressed = Palette.Black,
                            Text = ResxText.GamepadInstructions
                        },
                        new UIEntityItem // Keyboard Text
                        {
                            Size = this.Size,
                            Offset = this.Offset + new Vector2(x, startY + gap * 3 + lineOffset),
                            Font = FontLibrary.Body,
                            FontColorDefault = Palette.Black,
                            FontColorPressed = Palette.Black,
                            Text = ResxText.KeyboardInstructions
                        },
                    };
        }
    }
}
